package com.spring.schedule_system.controller;

import com.spring.schedule_system.dengxiaojiao.util.OptResult;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

import java.util.Map;

@LocalTCC
public interface VenBuDeliveryOrderSaveManager {

	/**
	 * tcc模式try 阶段执行接口
	 * @param domainIn
	 * @param context
	 * @return 返回是否成功
	 */
	@TwoPhaseBusinessAction(name = "omsCorevenBuDeliveryOrderSaveManagerHandle", commitMethod = "deliveryCommit", rollbackMethod = "deliveryRollback", useTCCFence = true)
	OptResult deliveryPrepare(Map<String, Object> map
			, BusinessActionContext context);


	/**
	 * tcc commit阶段执行逻辑
	 *
	 * @param context 上下文能够获取通过@BusinessActionContextParameter设置的参数
	 */
	void deliveryCommit(BusinessActionContext context);

	/**
	 * tcc cancel 阶段执行逻辑 上下文能够获取通过@BusinessActionContextParameter设置的参数
	 *
	 * @param context
	 */
	void deliveryRollback(BusinessActionContext context);
}
